LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;

-- DemoSaturatingCounter
-- 
-- Inputs:
-- incount = "Increment Counter". For some reason, using the name count causes errors because it's written
-- somewhere else.
-- reset = The reset signal.
--
-- Outputs:
-- saturatedcount = The contents of our counter.
--
-- This is just a basic saturating counter. I used this one to check the behavior of the larger saturating counter
-- that we're actually using.

ENTITY DemoSaturatingCounter IS
   PORT(
	   incount, reset			 : IN STD_LOGIC;
       saturatedcount 		 	 : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
       );
END DemoSaturatingCounter;

ARCHITECTURE dummy_satcounter_arch OF DemoSaturatingCounter IS

COMPONENT Three_Bit_Counter_Prototype IS
	PORT
	(
		aclr		: IN STD_LOGIC ;
		clock		: IN STD_LOGIC ;
		cnt_en		: IN STD_LOGIC ;
		q		: OUT STD_LOGIC_VECTOR (2 DOWNTO 0)
	);
END COMPONENT;

SIGNAL tempcount : STD_LOGIC_VECTOR(2 DOWNTO 0);

BEGIN

Count: Three_Bit_Counter_Prototype PORT MAP (reset, incount, NOT(tempcount(2)), tempcount);
saturatedcount <= tempcount;
   
END dummy_satcounter_arch;